package com.fs.controller;

import com.fs.annotation.SysLog;
import com.fs.pojo.Order;
import com.fs.pojo.OrderGoods;
import com.fs.service.OrderService;
import com.fs.vo.PageResult;
import com.fs.vo.SysResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "订单管理")
@RestController
@RequestMapping("/order")
@CrossOrigin
public class OrderController {

    @Autowired
    private OrderService orderService;


    @SysLog("订单列表")
    @ApiOperation(value = "订单列表")
    @RequiresPermissions({"order:list"})
    @GetMapping("/list")
    public SysResult getList(PageResult pageResult){
        return orderService.getList(pageResult);
    }


    @SysLog("订单详情")
    @ApiOperation(value = "订单详情")
    @RequiresPermissions({"order:info"})
    @GetMapping("/get/{id}")
    public SysResult getById(@PathVariable("id") Integer id){
        return orderService.getById(id);
    }

    @SysLog("修改发货状态")
    @ApiOperation(value = "修改发货状态")
    @RequiresPermissions({"order:edit"})
    @PutMapping(("/rev/{id}/{s}"))
    public SysResult updateRev(@PathVariable("id") Integer id,@PathVariable("s") Integer s){
        return orderService.updateRev(id,s);
    }
}
